package day12.demo1;

/**
 * @Auther:小陈的Java
 */
public class ThreadDemo2 extends Thread{
    public static void main(String[] args) {
        Thread thread1= new Thread(new ThreadA(),"线程A");
        Thread thread2 = new Thread(new ThreadB(),"线程B");
        thread1.start();
        thread2.start();

    }

}
class ThreadA implements Runnable{
    public void run(){
        for(int i = 1;i<=100;i++){
            if (i%2==0){
                System.out.println(Thread.currentThread().getName()+":"+i);
            }
        }
    }
}
class ThreadB implements Runnable{
    public void run(){
        for(int i = 1;i<=100;i++){
            if (i%2==1){
                System.out.println(Thread.currentThread().getName()+":"+i);
            }
        }
    }
}
